package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.ysd.entity.YingShiKu;
import com.ysd.util.DBManager;

public class YingShiKUDaoImpl {


	public List<YingShiKu> getYingShiLeiXing(){
		List<YingShiKu> list=new ArrayList<YingShiKu>();
		Connection conn = DBManager.getConnection();
		Statement st=null;
		ResultSet rs=null;
		YingShiKu ysk=null;
		
		try {
			st =conn.createStatement();
			rs=st.executeQuery("select *from YingShiKu");
			while(rs.next()){
				int pianId=rs.getInt("pianId");
				String pianName=rs.getString("pianName");
				String diQu=rs.getString("diQu");
				String yanYuan=rs.getString("yanYuan");
				int leiXingId=rs.getInt("leiXingId");
				ysk=new YingShiKu(pianId, pianName, diQu, yanYuan, leiXingId);
						
				list.add(ysk);
			}
			
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}finally {
			DBManager.closeAll(conn, st, rs);
		
	}
}
	

}
